package com.love.usedcar.api;


import com.love.common.core.constant.SecurityConstants;
import com.love.common.core.constant.ServiceNameConstants;
import com.love.common.core.web.domain.AjaxResult;
import com.love.usedcar.api.factory.RemoteCityFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;

@FeignClient(contextId = "remoteUsedcarService", value = ServiceNameConstants.USEDCAR_SERVICE, fallbackFactory = RemoteCityFallbackFactory.class)
public interface RemoteCityService {

    /**
     * 远程查询省份
     * @param source
     * @return
     */
    @GetMapping("/directory/getProvinces")
    public AjaxResult selectProvinces(@RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 远程查询城市
     * @param source
     * @return
     */
    @GetMapping("/directory/getCitys/{provinceCode}")
    public AjaxResult selectCitys(@RequestHeader(SecurityConstants.FROM_SOURCE) String source,@PathVariable("provinceCode") String provinceCode);

    /**
     * 远程查询城市级联数据
     * @param source
     * @return
     */
    @GetMapping("/directory/cascader")
    public AjaxResult cascader(@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
